import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * @Author shxl2021
 * @Date 2023/7/28 16:55
 * @Version 1.0
 */
public class SimpleDateFormatHelper implements Runnable {
    private static ThreadLocal<String > tl = new InheritableThreadLocal<>();
    private static SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    public static void main(String[] args) {
      boolean sb = false;
        if (sb = true) {

        }

    }

    public static void startMutiThreadTask(int taskNumber, Runnable runnable) {
        ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(3, 3, 100L, TimeUnit.MICROSECONDS, new ArrayBlockingQueue<>(1000), Thread::new, new ThreadPoolExecutor.AbortPolicy());
        for (int i = 0; i < taskNumber; i++) {
            threadPoolExecutor.submit(runnable);
        }

    }

    @Override
    public void run() {
        Thread currentThread = Thread.currentThread();
        Random random = new Random(60);
        int i = Math.abs(random.hashCode()) % 60;
        Date date = new Date();
        date.setSeconds(i);
        System.out.println(currentThread.getName()+"\tsec:"+i+" format:"+simpleDateFormat.format(date));
    }
}
